Learn R Programming

iDynoR (version 1.0)

Technique 5: Example Methods for Processing Solute Information: Technique 5: Example Methods for Processing Solute Information

Description

The previous section detailed methods that have been provided for extracting information from an env_State or env_Sum file. This section describes exemplar methods that have been provided to show how this data can be processed. Remember however that this package has been provided to enable you to access simulation data in R, and we hope that you will be able to build on these methods that we provide. Note that these methods read in the env_State or env_Sum files, thus there is no need to independently run Technique 1 in this case.

The following methods are available: env_soluteProductionRateOverTime: Processes all env_State files for a particular simulation run, storing the global production rate of a particular solute at each timepoint. A data frame of these responses is returned. This information could then be plotted if desired. plotContour: This routine draws a contour graph of the solute concentration field at a simultion timepoint.

Usage

env_soluteProductionRateOverTime(resultFileFolder, resultFileType, numTimepoints, outputPeriod,soluteReqd)
plotContour(resultFileFolder, timepoint, soluteReqd, folderForGraphOut)

Arguments

resultFileFolder
The directory containing all the result files written during the simulation.
resultFileType
The output response file type to read in. This should be either agent_State, agent_Sum, env_State, or env_Sum
numTimepoints
The number of timepoints comprising this simulation run
outputPeriod
The number of iterations between simulation output. See protocol section of tutorial
soluteReqd
An integer value representing the solute that is of interest. This can be taken from the order in the output file.
timepoint
A particular timepoint from which the solute contour should be plotted
folderForGraphOut
Each graph is output to file (as a pdf). This should specify the folder where the graph should be written to

Examples

Run this code
## Not run: 
# # DONTRUN IS SET SO THIS IS NOT EXECUTED WHEN PACKAGE IS COMPILED - BUT THIS
# # HAS BEEN TESTED THOROUGHLY BEFORE UPLOADING TO THE REPOSITORY
# 
# # Track the production or consumption rate of glucose (first solute) over time, 
# # for 48 timepoints, where the output period was 1 (every step)
# glucoseProduction<-
# env_soluteProductionRateOverTime("/home/user/iDynoMiCS/results/", 
# "env_Sum", 48, 1,1)
# 
# # Plot the contour for glucose (1) at timepoint 40
# plotContour("/home/user/Desktop/iDynoMiCS/results/single_species/", 40, 1, 
# "/home/user/Desktop/iDynoMiCS/results/single_species/graphs/")
# 
# ## End(Not run)

Run the code above in your browser using DataLab